package com.neusoft.shopping.manager.controller;

import com.neusoft.shopping.manager.entity.LogisticsEntity;
import com.neusoft.shopping.manager.service.LogisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
public class LogisticsController {
    @Autowired
    LogisticsService service;
    @RequestMapping("/logistics_show")
    public ModelAndView logistics_show(){
        ModelAndView modelAndView=new ModelAndView();
        List<LogisticsEntity> logistics=service.qureyAll();
        modelAndView.addObject("logistics",logistics);
        modelAndView.setViewName("logistic_show");
        return modelAndView;
    }
    @RequestMapping("/logistics_add/{orderno}")
    public ModelAndView logistics_add(@PathVariable("orderno") Integer orderno){
        ModelAndView modelAndView=new ModelAndView();
        modelAndView.addObject("orderno",orderno);
        modelAndView.setViewName("logistics_modify");
        return modelAndView;
    }
    @RequestMapping("/logistics_modifyConservr")
    public ModelAndView logistics_modifyConservr(LogisticsEntity logistic){
        service.add_logistics(logistic);
        return this.logistics_show();
    }
}
